package com.example.springcloudeurekaserverproducer.controller;

import com.alibaba.fastjson.JSON;
import com.example.springcloudeurekaserverproducer.services.KanbanPolicepresonServices;
import com.example.springcloudeurekaserverproducer.vo.KanbanPolicepreson;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Collection;

@RunWith(SpringJUnit4ClassRunner.class)
//@SpringApplicationConfiguration(classes = Application.class)//这里的Application是springboot的启动类名。
@SpringBootTest
//@WebAppConfiguration
public class KanBanTest {
	/* @Autowired
	    private WebApplicationContext context;
	    private MockMvc mvc;*/

	    @Autowired 
	    private KanbanPolicepresonServices kanbanPolicepresonServices;
	    @Autowired
	    private KanbanController kanbanController;

	    @Test
	    public void test4() throws Exception {

					KanbanPolicepreson info=new KanbanPolicepreson();
					info.setCreateBy("1");
					info.setLevel(1);
					 kanbanPolicepresonServices.update(info);
	 


	    }
	    @Test
	    public void test1() throws Exception {

					KanbanPolicepreson info=new KanbanPolicepreson();
					info.setCreateBy("22222");
//					info.setLevel(1);
			BaseBean<Collection<KanbanPolicepreson>> k=	kanbanController.select(info);
			System.out.println("k = " + k + "," + "当前类=KanBanTest.test1()");


		}
//	    @Test
//	    public void test1() throws Exception {
//	    	 KanbanPolicepreson info=new KanbanPolicepreson();
//		    	info.setId("4b35895c8d334612a853abb237fb3f42");
////		    	info.setCreateBy("1");
////		    	info.setCreateTime(DateUtil.getStringDate());
//		    	info.setLevel(1);
//		    	info.setPercentage(20);
//		    	info.setPlatformProjectId("1");
//		    	info.setPlatformType("1");
////		    	info.setUpdateBy("1");
//		  KanbanPolicepreson list =	 kanbanPolicepresonServices.queryById(info);
////		  List< KanbanPolicepreson> list1 =	 kanbanPolicepresonServices.select(info);
//		   System.out.println(JSON.toJSONString(list));
////	    System.out.println(KanbanController.getAll( "2","2"));
//	    }
	  /*  @Before
	    public void setUp() throws Exception {
	 //       mvc = MockMvcBuilders.standaloneSetup(new TestController()).build();
	 //       mvc = MockMvcBuilders.webAppContextSetup(context).build();//建议使用这种
	    }
	 @Test
	    public void test12() throws Exception {
	    System.out.println(KanbanController.getAll( "",""));
	    }*/
//	      @Test
//	    public void test3() throws Exception {
//	    	System.out.println(KanbanController.getKanbanPolicedeliveries( "MTI0MTIxOzQx","0"));
//	    	System.out.println(KanbanController.getKanbanPolicepreson( "MTI0MTIxOzQx","0"));
//	    }
//	    @Test
//	    public void test2() throws Exception {
////	        mvc.perform(MockMvcRequestBuilders.post("/kanban/insert")
////	                .contentType(MediaType.APPLICATION_JSON_UTF8)
////	                .param("id", "12")
////	                .accept(MediaType.APPLICATION_JSON))
////	                .andExpect(MockMvcResultMatchers.status().isOk())
////	                .andDo(MockMvcResultHandlers.print())
////	               ;
//	    	//[{"createBy":"1","createTime":"2018-07-09 11:55:03","id":"25068e7394404d0d932f71b11cd28a28","level":1,"percentage":1,"platformProjectId":"1","platformType":"1","updateBy":"1","updateTime":"2018-07-09 11:55:03"}]
//	    	List<KanbanPolicedeliveries> list=new ArrayList<KanbanPolicedeliveries>();
//	    	KanbanPolicedeliveries info=new KanbanPolicedeliveries();
//	    	info.setId("25068e7394404db11cd28a28");
////	    	info.setCreateBy("1");
////	    	info.setCreateTime(DateUtil.getStringDate());
//	    	info.setLevel(1);
//	    	info.setPercentage(10);
//	    	info.setPlatformProjectId("1");
//	    	info.setPlatformType("1");
////	    	info.setUpdateBy("1");
////	    	info.setUpdateTime(DateUtil.getStringDate());
//	    	list.add(info);
//	    	KanbanPolicedeliveries info1=new KanbanPolicedeliveries();
//	    	info1.setLevel(2);
//	    	info1.setPercentage(50);
//	    	info1.setPlatformProjectId("1");
//	    	info1.setPlatformType("1");
//	    	list.add(info1);
//	    	KanbanController.insertKanbanPolicedeliveries(JSON.toJSONString(list),"1");
//	    }
}
